#!/bin/bash

#=======================================================================
# wikipedia-export
# File ID: a7ef1800-5d49-11df-a875-90e6ba3022ac
# Exports a Wikipedia article as XML.
#
# Newest version available from 
# http://svn.sunbase.org/repos/utils/trunk/wikipedia-export
#
# This complicated piece of software is licensed under the GNU General 
# Public License version 2 or later.
# Made by Øyvind A. Holm <sunny@sunbase.org>.
#=======================================================================

curonly='&curonly=true'
[ "$1" = "-a" ] && { unset curonly; shift; }

if [ "$2" = "" ]; then
    echo Syntax: $0 [-a] language_prefix \'article_name\'
    echo
    echo If -a is specified as the first parameter, all revisions are downloaded.
    exit 1
fi

wget -O "$1.$2.xml" http://$1.wikipedia.org/wiki/Special:Export?action=submit$curonly\&pages=$2

# This program is free software; you can redistribute it and/or modify it 
# under the terms of the GNU General Public License as published by the 
# Free Software Foundation; either version 2 of the License, or (at your 
# option) any later version.
# 
# This program is distributed in the hope that it will be useful, but 
# WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along 
# with this program; if not, write to the Free Software Foundation, Inc., 
# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
